import jpype
import redis

def redis_test():
    try:
        myredis = redis.StrictRedis(host='localhost', port=6379)
    except Exception as e:
        print(e.message)
    myredis.set('name','xiaoming')
    myvalue = myredis.get('name')       # 返回的是字节流
    mystr = myvalue.decode('utf-8')
    print(mystr)

jvmPath = jpype.getDefaultJVMPath()
jpype.startJVM(jvm=jvmPath)
sout = jpype.java.lang.System.out.println
sout("hello")
redis_test()
